package com.yxym.static_;

public class ChildGame {
    public static void main(String[] args) {
        int count = 0;
        Child child = new Child("小白");
        child.join();
        child.count++;

        Child child1 = new Child("小青");
        child1.join();
        child1.count++;

        System.out.println("共有" + child1.count + "位小姐姐加入游戏");
    }
}

class Child{
    private String name;
    public static int count = 0;
    //定义基本变量count，是一个类变量static静态
    //被Child类中所有对象实例共享
    public Child(String name) {
        this.name = name;
    }
    public void join(){
        System.out.println(name + "加入游戏");
    }
}